import { Dict } from "./Defined";
import { KGameErr } from "../err/KGameErr";

/**
 * 常量类
 */
export class KConst {

    /** 空字典 */
    static readonly EMPTY_DICT: Readonly<Dict> = {};
    /** 空数组 */
    static readonly EMPTY_ARR: readonly any[] = [];
    /** 空集合 */
    static readonly EMPTY_SET = new Set<any>();
    /** 空映射 */
    static readonly EMPTY_MAP = new Map<any, any>();
    /** 临时字典 */
    static readonly TMP_DICT: Dict = {};
    /** 临时数组 */
    static readonly TMP_ARR: any[] = [];
    /** 临时集合 */
    static readonly TMP_SET = new Set<any>();
    /** 临时映射 */
    static readonly TMP_MAP = new Map<any, any>();

}

Object.defineProperty(KConst.EMPTY_SET, "add", { get: () => () => { throw new KGameErr("不允许修改EMPTY_SET的值") } });
Object.defineProperty(KConst.EMPTY_MAP, "set", { get: () => () => { throw new KGameErr("不允许修改EMPTY_MAP的值") } });